module.service('Image', ['$rootScope', function ($rootScope) {
    var service = {
        _baseUrl: "/azeroth/back/image/",
        imageList: [],
        totalSceneCount: 0,
        queryList: function (uploadTime, currentPage, pageSize, callback) {

            var paramData = {
                uploadTime: uploadTime ? uploadTime.getTime() : ""
            };
            $rootScope.ajaxRequestPost(service._baseUrl + "getFileList.htm", paramData, function (resultJson) {

                var tempImageList = [];
                $.each(resultJson.data, function (key, value) {
                    tempImageList.push({'url': value});
                });
                angular.copy(tempImageList, service.imageList);
                if (callback) {
                    callback();
                }
            });
        },
        removeImageList: function (selectedItemList, callback) {

            var paramData = {
                fileList: selectedItemList.join(",")
            };
            $rootScope.ajaxRequestPost(service._baseUrl + "deleteFile.htm", paramData, function (resultJson) {

                if (callback) {
                    callback();
                }
            });
        }

    };
    return service;
}]);
